import java.util.Arrays;

public class StringDemo {
    public static void main(String[] args) {
        String s = "你好 tom  is good ";
        String[] split = s.split(" ");
        System.out.println(Arrays.toString(split));
        StringBuffer stringBuffer = new StringBuffer("你好 tom  is good");
        System.out.println(stringBuffer.toString());
        System.out.println(stringBuffer);

        play(new Dog());
    }

    public static void play(Animal animal) {//多态
        if (animal instanceof Dog) {
            Dog dog = (Dog) animal;
            dog.catchCat();
        } else if (animal instanceof Cat) {
            Cat cat = (Cat) animal;
            cat.eatMouse();
        }
    }
}

class Animal {

}

class Dog extends Animal {
    public void catchCat() {
        System.out.println("狗崽子正在抓猫崽子");
    }
}

class Cat extends Animal {
    public void eatMouse() {
        System.out.println("猫崽子正在抓老许子");
    }
}